package com.chen.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chen.entity.User;
import com.chen.entity.UserRechargeOrders;
import com.chen.service.UserRechargeOrdersService;
import com.chen.utils.UserThreadLocal;
import com.chen.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户充值订单表 前端控制器
 * </p>
 *
 * @author cws
 * @since 2024-11-28
 */
@RestController
@RequestMapping("/mall/userRechargeOrders")
public class UserRechargeOrdersController {

    @Resource
    private UserRechargeOrdersService userRechargeOrdersService;

    @GetMapping("/list")
    public Result list(){
        User user = UserThreadLocal.get();
        LambdaQueryWrapper<UserRechargeOrders> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserRechargeOrders::getUserId, user.getId());
        wrapper.eq(UserRechargeOrders::getStatus, "成功");
        List<UserRechargeOrders> list = userRechargeOrdersService.list(wrapper);
        return Result.success(list);
    }

}

